home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1996 #15
/
Monster Media Number 15 (Monster Media)(July 1996).ISO
/
os2
/
srefv112.zip
/
INTERPET.IN
< prev
next >
Wrap
Text File
|
1996-05-12
|
5KB
|
136 lines
; This file contains "INTERPRET" rexx-code blocks for use by
;the INTERPRET keyphrase of SRE-FILTER. 5/96
;
;Each rexx-code block should be labeled with a {label}, then the rexx-code
;block follows, with the next label (or eof) signalling the end
;of the block.
;
;General Usage notes:
;
; To include output in the document, store results in INTERRET.RESULTS
;
; Seperate rexx-code lines with a semi-colon
;
; In addition to the functions available through goserve (including
; REQFIELD, SERVERNAME(), CLIENTNAME(), etc.), SREFILTER provides the following
; variables:
; crlf : the line seperator
; tmp. : To be safe, store temporary results in tmp.xx variables
; dir : Working directory (i.e. E:/GOHTTP/)
; who: ip of requester
; whoport: port of requester
; request : request #
; transaction: transaction # (maybe several transactions per request)
; tempfile: Unique file name for this transaction (use for a working file)
; myaddr: Server's ip
; sel : Orginal request string
;
;
;Some sample Code Blocks:
; Several samples are included below. Of particular interest is USE_TABLE.;
;
; USE_TABLE : Detects whether the requesting browser understands the
; TABLE element. If so, INCLUDES xxx.TBL, if not, includes xxx.DEF.
; GET_HIT: Finds # of hits for current URL (NOT including this one).
; Returns result in CURRENT_HIT.NUM
; AUGMENT_HIT: Same as GET_HIT, but does include current hit (that is, it
; modifies COUNTER.CNT.
; AUDIT_CLIENTNAME: Write the client ip name to the audit file
;
;
; Notes
; GET_HIT and AUGMENT_HIT are useful if you
; call an external procedure that creates counter GIFS.
;
; Details on USE_TABLE:
; xxx is the name of the action -- and xxx.TBL and xxx.DEF should be
; in the SAME DIRECTORY AS THE HTML DOCUMENT!!
;
; The ambitious user may wish to augment the TABLE_LIST stem variable.
;
; The USETABL2.RXX file contains a more sophisticated version of
; USE_TABLE,
; ..if the browser does not appear on the
; "table_list", a "tell me if you can handle TABLEs" document is
; sent back.. and depending on the answer, either xxx.TBL
; or xxx.DEF is included.
;
;---- End comments section.
{TEST1} interpret=results=' <h3> This is a test </h3> '
{GO_to_bed} tmp.jj=time('h') ; SAY " BED 1 " ;
if tmp.jj<5 | tmp.jj>20 then do ;
interpret.results= ' <STRONG> It is very late</STRONG> ' ;
interpret.results=interpret.results||crlf||" aren't you tired? " ;
end ;
{AUDIT_CLIENTNAME}
if clientname0=0 then ;
TMP1=clientname() ;
else ;
TMP1=clientname0 ;
audit " Client Name: " tmp1 ' on ' date() ;
{GOOD_MORNING }
tmp.jj=time('h') ;
select ;
when tmp.jj<7 then
tmp='<em> It is very early? </em> ' ;
when tmp.jj<12 & temp.jj > 6 then
tmp='<em> Good morning </em> ' ;
when tmp.jj<19 & temp.jj > 11 then
tmp='<em> Good afternoon </em> ' ;
otherwise
tmp='<em> Good evening.. </em> ' ;
end ;
interpret.results=tmp
{get_hit} /* Get current # of hits (NOT including this one), store in current_hit.num */
current_hit.num=lookup_count(counter_file,action) ; say ' Hits = ' current_hit.num;
{augment_hit} /* Augment # of hits, save results in current_hit.num, do not
display results */
current_hit.num=lookup_count(counter_file,action,'ADD') ;say ' +Hits = 'current_hit.num;
{USE_TABLE}
/* -- add "table capable browser" User-agent identifiers here -- */
/* Note that "abbreviation match is performed (don't worry about extra
stuff after the last character in each table_list entry) */
table_list.1='IBM WebExplorer DLL /v1.03' ;
table_list.2="Mozilla/2.0";
table_list.3="Mozilla/1.1";
table_list.4="Mozilla/1.2";
table_list.5="Mozilla/1.3";
table_list.6="IBM-WebExplorer-DLL/v1.1";
table_list.0=6 ;
/* -- do not change below here --- */
putme=reqfield("User-Agent") ;
isat=lastpos('.',docname);
docname0=docname ;
if isat>0 then
docname0=delstr(docname,isat) ;
docname1=docname0||'.DEF' ;
if putme<>" " then do ;
do mm=1 to table_list.0 ;
if abbrev(translate(putme),translate(table_list.mm))=1 then do;
docname1=docname0||'.TBL' ;
leave ;
end ;
end;
end;
interpret.results=delim_1.1||'INCLUDE '||docname1||delim_2.1 ;
{END}